package com.example.edu.Dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {
    private boolean success;
    private String errMessage;
    private Object data;
    private int total;

    public static Result ok(){
        return new Result(true,null,null,0);
    }

    public static Result ok(Object data){
        return new Result(true,null,data,1);
    }

    public static Result ok(List<?> data){
        return new Result(true,null,data, data.size());
    }

    public static Result fail(String errMessage){
        return new Result(false,errMessage,null,0);
    }
}
